package com.cskaoyan.controller.admin.statisticalcontroller;

import com.cskaoyan.bean.statisticalbean.StatisticalBean;
import com.cskaoyan.service.statisticalservice.StatisticalService;
import com.cskaoyan.vo.BaseRespVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ked
 * @createTime 2021年05月10日 20:14:00
 */

@RestController
public class StatisticalController {

    @Autowired
    StatisticalService statisticalService;

    //当天新用户注册量统计
    @RequiresPermissions("admin:stat:user")
    @RequestMapping("admin/stat/user")
    public BaseRespVo userStatistical(){
        StatisticalBean statisticalBean = statisticalService.queryUserStatistical();
       return BaseRespVo.ok(statisticalBean,"成功");
    }

    //今年的订单数量统计
    @RequiresPermissions("admin:stat:order")
    @RequestMapping("admin/stat/order")
    public BaseRespVo orderStatistical(){
        StatisticalBean statisticalBean = statisticalService.queryOrderStatistical();
        return BaseRespVo.ok(statisticalBean,"成功");
    }
    @RequiresPermissions("admin:stat:goods")
    @RequestMapping("admin/stat/goods")
    public BaseRespVo goodsStatistical(){
        StatisticalBean statisticalBean = statisticalService.queryGoodsStatistical();
        return BaseRespVo.ok(statisticalBean,"成功");
    }
}
